package redMoney;

import java.util.ArrayList;

public class Manager extends PiblicUser{
    public Manager() {
    }

    public Manager(String name, Integer money) {
        super(name, money);
    }
    public ArrayList<Integer>send(int totalMoney,int count){
        ArrayList<Integer>redLIst=new ArrayList<>();
        Integer leftmoney = super.getMoney();//余额
        if (totalMoney>leftmoney){
            System.out.println("余额超过要发的钱数，红包发不了");
            return redLIst;
        }
        int avg=totalMoney/count;
        for (int i = 0; i <count-1 ; i++) {
            redLIst.add(avg);
        }
        //最后一个红包
        int last=avg+ totalMoney % count;
        redLIst.add(last);
        //发完红包后，余额为：
        super.setMoney(leftmoney-totalMoney);
        return redLIst;
    }

}
